package games;

public class Controller {
	private int x;
	private int y;
	private int oldX;
	private int oldY;
	private boolean hasChanged = false;
	private boolean firstMove = true;
	
	public void setCoordinate(int x, int y) {
		if(!firstMove) {
			this.x = x;
			this.y = y;
			this.hasChanged = true;
		}
		else {
			this.oldX = x;
			this.oldY = y;
			this.firstMove = false;
		}
	}
	
	public Coordinate getCoordinate() {
		System.out.println("X: " + x + " Y: " + y);
		return new Coordinate(x, y);
	}
	
	public Coordinate getOldCoordinate() {
		System.out.println("oldX: " + oldX + " oldY: " + oldY);
		return new Coordinate(oldX, oldY);
	}
	
	public boolean userMadeAMove() {
		if(this.hasChanged) {
			this.hasChanged = false;
			return true;
		} else return false;
	}
}
